#include<bits/stdc++.h>
using namespace std;
inline int read() {
    int x=0,f=0,ch=getchar();
    while(!isdigit(ch)) f|=ch=='-',ch=getchar();
    while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=1e5+5;
int n;
int a[N];
int b[N];
int cnt[N];
int tot;
void work() {
    for(int i=1;i<=n;i++) {
        if(a[i]!=a[i-1]) {
            b[++tot]=a[i];
        }
        cnt[tot]++;
    }
}
void solve() {
    int res=n;
    int p=0;
    for(int i=1;i<=tot;i++) {
        if(cnt[i]<p) {
            res-=cnt[i];
        }
        if(cnt[i]>=p) {
            res-=p;
            p=cnt[i];
        }
    }
    cout<<res;
}
int main() {
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    for(int i=1;i<=n;i++) a[i]=read();
    sort(a+1,a+1+n);
    work();
    solve();
    return 0;
}
